/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.f1x.api.message.fields;

// Generated by org.f1x.tools.DictionaryGenerator from QuickFIX dictionary
public enum StipulationValue implements org.f1x.api.message.types.StringEnum {
	SPECIAL_CUM_DIVIDEND("CD"),
	SPECIAL_EX_DIVIDEND("XD"),
	SPECIAL_CUM_COUPON("CC"),
	SPECIAL_EX_COUPON("XC"),
	SPECIAL_CUM_BONUS("CB"),
	SPECIAL_EX_BONUS("XB"),
	SPECIAL_CUM_RIGHTS("CR"),
	SPECIAL_EX_RIGHTS("XR"),
	SPECIAL_CUM_CAPITAL_REPAYMENTS("CP"),
	SPECIAL_EX_CAPITAL_REPAYMENTS("XP"),
	CASH_SETTLEMENT("CS"),
	SPECIAL_PRICE("SP"),
	REPORT_FOR_EUROPEAN_EQUITY_MARKET_SECURITIES("TR"),
	GUARANTEED_DELIVERY("GD");

	private final String code;

	StipulationValue (String code) {
		this.code  = code;
		bytes = code.getBytes();
	}

	public String getCode() { return code; }

	private final byte[] bytes;
	public byte[] getBytes() { return bytes; }


	public static StipulationValue parse(String s) {
		switch(s) {
			case "CD" : return SPECIAL_CUM_DIVIDEND;
			case "XD" : return SPECIAL_EX_DIVIDEND;
			case "CC" : return SPECIAL_CUM_COUPON;
			case "XC" : return SPECIAL_EX_COUPON;
			case "CB" : return SPECIAL_CUM_BONUS;
			case "XB" : return SPECIAL_EX_BONUS;
			case "CR" : return SPECIAL_CUM_RIGHTS;
			case "XR" : return SPECIAL_EX_RIGHTS;
			case "CP" : return SPECIAL_CUM_CAPITAL_REPAYMENTS;
			case "XP" : return SPECIAL_EX_CAPITAL_REPAYMENTS;
			case "CS" : return CASH_SETTLEMENT;
			case "SP" : return SPECIAL_PRICE;
			case "TR" : return REPORT_FOR_EUROPEAN_EQUITY_MARKET_SECURITIES;
			case "GD" : return GUARANTEED_DELIVERY;
		}
		return null;
	}

}